<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>鑫立方管理系统</title>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/main.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/designer.css" />
<script type="text/javascript" src="<%=basePath%>js/libs/modernizr.min.js"></script>

<script src="<%=basePath%>js/jquery-1.10.2.min.js"></script>
</head>
<body>
  <script type="text/javascript" src="<%=basePath%>js/wz_tooltip.js"></script>
  <div align="center">
    <jsp:useBean id="planList" class="com.xlf.cache.PlanList" />
    <jsp:useBean id="orderStatusList" class="com.xlf.cache.OrderStatusList" />
    <table width="95%" class="insert-tab-print">
      <tr>
        <td colspan="4"><h3>订单信息</h3></td>
      </tr>
      <tr>
        <td style="text-align:right; width:200px; padding-right:10px;">订单编号:</td>
        <td>${order.o_id }</td>
        <td style="text-align:right; width:200px; padding-right:10px;">创建日期:</td>
        <td><fmt:formatDate value="${order.createTime }" pattern="yyyy-MM-dd" /></td>
      </tr>
      <tr>
        <td style="text-align:right; padding-right:10px;">设计师姓名:</td>
        <td>${order.designerName }</td>
        <td style="text-align:right; padding-right:10px;">订单状态:</td>
        <td>${orderStatusList.getName(order.status) }</td>
      </tr>
      <tr>
        <td style="text-align:right; padding-right:10px;">套餐类型:</td>
        <td>${planList.getName(order.planType) }</td>
        <td style="text-align:right; padding-right:10px;">订单价格:</td>
        <td>
          ￥${order.price }
          <c:if test="${order.discount > 0 }">
            <font color="blue">&nbsp;(${order.discount }&nbsp;折后价格)</font>
          </c:if>
        </td>
      </tr>
      <tr>
        <td colspan="4"><h3>客户信息</h3></td>
      </tr>
      <tr>
        <td style="text-align:right; padding-right:10px;">客户姓名:</td>
        <td>${order.custerName }</td>
        <td style="text-align:right; padding-right:10px;">客户电话:</td>
        <td>${order.custerTel }</td>
      </tr>
      <tr>
        <td style="text-align:right; padding-right:10px;">客户地址</td>
        <td>${order.custerAddress }</td>
        <td style="text-align:right; padding-right:10px;">房屋面积</td>
        <td>${order.roomSize }</td>
      </tr>
    </table>
    <div style="page-break-after: always;">&nbsp;</div>
    
    <c:forEach items="${orderCatalogs }" var="orderCatalog" varStatus="s">
    <table width="95%" class="insert-tab-print">
      <c:if test="${order.planType == 4 }">
        <c:set var="colspanSize" value="12"></c:set>
      </c:if>
      <c:if test="${order.planType != 4 }">
        <c:set var="colspanSize" value="11"></c:set>
      </c:if>
        <c:if test="${orderCatalog.getOrderItems().size() > 0 }">
          <tr>
            <td colspan="${colspanSize }"><h3>${orderCatalog.name }</h3></td>
          </tr>
          <tr>
            <c:if test="${orderCatalog.c_id == 9 }">
              <td>名称</td>
            </c:if>
            <c:if test="${orderCatalog.c_id != 9 }">
              <td>图片</td>
              <td>品牌</td>
              <td>型号</td>
              <td>规格</td>
              <td>材质</td>
            </c:if>
            <td>单位</td>
            <c:if test="${order.planType == 4 }">
              <td>价格</td>
            </c:if>
            <td>数量</td>
            <td>使用位置</td>
            <td>备注</td>
          </tr>
          <c:forEach items="${orderCatalog.getOrderItems() }" var="orderItem" varStatus="s">
          <tr>
            <c:if test="${orderCatalog.c_id == 9 }">
              <td>${orderItem.get('brand') }</td>
            </c:if>
            <c:if test="${orderCatalog.c_id != 9 }">
              <td>
              <a href="#" onmouseover="TagToTip('span${orderItem.get('p_id') }');" onmouseout="UnTip();"><img src="<%=basePath %>upload/${orderItem.get('pic') }" border="0" class="product_img"/></a>
              <span id="span${orderItem.get('p_id') }">
                <img src="<%=basePath %>upload/${orderItem.get('pic') }" width="196px" height="196px">
              </span>
              </td>
              <td>${orderItem.get('brand') }</td>
              <td>${orderItem.get('type') }</td>
              <td>${orderItem.get('spec') }</td>
              <td>${orderItem.get('material') }</td>
            </c:if>
            <td>${orderItem.get('unit') }</td>
            <c:if test="${order.planType == 4 }">
              <td>${orderItem.get('price') }</td>
            </c:if>
            <td>${orderItem.get('count') }</td>
            <td>${orderItem.get('location') }</td>
            <td>${orderItem.get('itemRemark') }</td>
          </tr>
          </c:forEach>
          <tr>
            <td colspan="${colspanSize }">补充说明(特殊工艺或造型)</td>
          </tr>
          <tr>
            <td colspan="${colspanSize }">
              <c:if test="${orderCatalog.catalogRemark != null && orderCatalog.catalogRemark != '' }">
                ${orderCatalog.catalogRemark }              
              </c:if>
              <c:if test="${orderCatalog.catalogRemark == null || orderCatalog.catalogRemark == '' }">
                无
              </c:if> 
            </td>
          </tr>
          <tr>
            <td colspan="${colspanSize }">
              <span style="padding-left: 10px;">客户签字:</span>
              <span style="padding-left: 30%">主材专员签字：</span>
              <span style="padding-left: 30%">主材经理签字:</span>
            </td>
          </tr>
        </c:if>
    </table>
    <div style="height: 10px;"></div>
    <div style="page-break-after: always;">&nbsp;</div>
    </c:forEach>
    <table class="insert-tab-print" width="95%">
      <tr>
        <td><h3>订单备注（增减项说明）</h3></td>
      </tr>
      <tr>
        <td>${order.orderRemark }</td>
      </tr>
      <tr>
        <td>
          <span style="padding-left: 10px;">客户签字:</span>
          <span style="padding-left: 30%">主材专员签字：</span>
          <span style="padding-left: 30%">主材经理签字:</span>
        </td>
      </tr>
    </table>
  </div>
</body>
</html>